/**
 * @author Chad Dettmering
 */

package org.flckphoto;

import android.net.Uri;
import android.util.Log;
import android.webkit.*;

/**
 * Extends WebViewClient to ensure that the flickr login will be loaded
 * on the embedded webview instead of the web browser
 */
public class FlickrWebViewClient extends WebViewClient{
	
	/**
	 * tag for log output
	 */
	private static final String TAG = "FlickrWebViewClient";
	
	/**
	 * Overrides the url loading
	 */
	@Override
	public boolean shouldOverrideUrlLoading(WebView view, String url) {
		Log.d(TAG,"Webview is handling the page loading");
		String host = Uri.parse(url).getHost();
		if(host.equalsIgnoreCase("www.yahoo.com") ||
			host.equalsIgnoreCase("www.flickr.com") ||
			host.equalsIgnoreCase("api.flickr.com") ||
			host.equalsIgnoreCase("m.flickr.com") ||
			host.equalsIgnoreCase("mlogin.yahoo.com")) {
			return false;
		}
		return true;
	}
	                                       

}
